{extend name="apps/common/view/front.tpl" /}
<!-- -->
{block name="header_meta"}
<title>MarkDown编辑器演示－{:config('common.site_name')}</title>
<meta name="keywords" content="markdown" />
<meta name="description" content="呆错应用开发框架使用MarkDown编辑器作为框架默认编辑器的演示。"  />
{/block}
<!--main -->
{block name="main"}
<div class="container pt-5">
  <h2 class="text-center mt-5 mb-3">MarkDown编辑器</h2>
  <h6 class="text-center mb-3">{volist name=":config('common.site_applys')" id="apply"}
  <a class="text-muted small mx-1" href="{:DcUrl($apply['module'].'/index/index','','')}">{$apply.name|DcHtml|DcSubstr=0,20,false}</a>
    {/volist}</h6>
  {:DcBuildForm([
    'class'    => 'bg-white py-3',
    'action'   => DcUrl('markdown/index/index', '', ''),
    'method'   => 'post',
    'ajax'     => true,
    'submit'   => lang('submit'),
    'reset'    => lang('reset'),
    //'close'    => lang('close'),
    'disabled' => false,
    'callback' => '',
    'data'     => '',
    'items'=>[
        [
            'type'=>'editor',
            'name'=>'dc_editor',
            'id'=>'dc_editor',
            'title'=>'',
            'placeholder'=>'editor',
            'tips'=>'',
            'value'=>'呆错（DaiCuo）是一款基于ThinkPHP、Bootstrap、Jquery的极速后台开发框架',
            'rows'=>12,
            'autofocus'=>false,
            'readonly'=>false,
            'disabled'=>false,
            'required'=>true,
            'class'=>'row form-group',
            'class_left'=>'col-12',
            'class_right'=>'col-12',
            'class_right_control'=>'',
            'class_tips'=>'',
        ],
    ]
  ])}
  <h6 class="mt-5">MarkDown代码服务端解析（PHP）</h6>
  <p id="parsePhp">{:markdownParse('**呆错（DaiCuo）**是一款基于ThinkPHP、Bootstrap、Jquery的极速后台开发框架')}</p>
  <h6 class="mt-5">MarkDown代码客户端解析（Javascript）</h6>
  <p id="parseJs">……</p>
</div>
{/block}
<!-- -->
{block name="js"}
<script>
$(document).ready(function () {
    window.daicuo.ajax.script(daicuo.config.root+'apps/markdown/static/hyperdown.min.js',function(){
        var parser = new HyperDown();
        var html = parser.makeHtml('**呆错（DaiCuo）**是一款基于ThinkPHP、Bootstrap、Jquery的极速后台开发框架');
        $('#parseJs').html(html);
    });
});
</script>
{/block}